package com.buguniao;

import com.buguniao.jobs.PrintJob;
import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;

/**
 * Created by buguniao on 2017/7/23.
 */
public class Main {
    public static void main(String[] args) throws Exception {
        JobDetail jobDetail = JobBuilder.newJob(PrintJob.class)
                                        .withIdentity("job1","group1")
                                        .usingJobData("count",new Integer(0))
                                        .build();

        JobDetail jobDetail2 = JobBuilder.newJob(PrintJob.class)
                .withIdentity("job2","group2")
                .usingJobData("count",new Integer(0))
                .build();


        Trigger trigger = TriggerBuilder.newTrigger()
                                        .startNow()
                                        .withSchedule(CronScheduleBuilder.cronSchedule("0/1 * * * * ?"))
                                        .build();


        Scheduler scheduler  = StdSchedulerFactory.getDefaultScheduler();

        scheduler.start();
//        scheduler.resumeJob(jobDetail.getKey());

//        scheduler.scheduleJob(jobDetail,trigger);
//        scheduler.rescheduleJob(trigger.getKey(),trigger);

        Thread.sleep(10*60*000);
        scheduler.shutdown(true);
    }
}
